package util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import recursos.Sesion;

public class Conexion {

	private static String url = "jdbc:as400://"+Sesion.ip+"/SPEED400TC"+";prompt=false";
	private static String usuario = "INV2014";
	private static String password = "ASUMARE";
	private static Connection cn = null;
	
	static {
		try {
			Class.forName("com.ibm.as400.access.AS400JDBCDriver");
			cn = DriverManager.getConnection(url, usuario, password);
		} catch (ClassNotFoundException e) {
			System.out.println(e);
		} catch (SQLException e) {
			e.printStackTrace();
		} 
	}
	
	public static Connection obtenerConexion() {
		return cn;
	}

	public static void desconectar() throws SQLException {
		cn.close();
		
	}
		
}